<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>微信 QR 支付Demo</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
</head>
<body>
<div id="qrcode"></div>
{literal}
<script>
    var qrcode = new QRCode(document.getElementById("qrcode"), {
        width : 100,
        height : 100
    })
    fetch(`${window.location.origin}/cms/api/home/pay/wechat_pay`, {
        method: 'post',
        headers: {
            'content-type': 'application/json',
            'Authorization': '609255abd413916202029238694945523' // 登录凭证
        },
        body: JSON.stringify({
            type: 'native',
            total_fee: 100
        })
    }).then(res => {
        return res.json()
    }).then(res => {
        qrcode.makeCode(res.items.code_url);
    })
</script>
{/literal}
</body>
</html>